<?php
//------------------------------------------------------------------------------
// Class              : Ctl_Info
// Modification       :
//------------------------------------------------------------------------------
// Date(yyyy.mm.dd)   Developer                       Action
//------------------------------------------------------------------------------
// 2007.03.15         ThanhTX                         Created
//------------------------------------------------------------------------------

class Ctl_Home extends ControlBase{
    var $modul="home";
    //==========================================================================
    // Function    : Ctl_Info
    // Creator     : ThanhTX 2007.03.15
    // Details     : Call the constructor of father class to initial variable
    //==========================================================================
    function Ctl_Home(){
         // Constructor of father class.
         ControlBase::ControlBase();
    }

    //==========================================================================
    // Function    : execute
    // Creator     : ThanhTX 2007.03.15
    // Details     : Execute the process depend the given mode, 
    //               as: Add, Delete, Edit and default is List.
    //==========================================================================
     function execute($action=""){
        global $db, $arrayError, $_POST;
        $arrayData_KM =  array();
		$arrayData_BC = array();
		$arrayData_New = array();
				
        // Get back the work you want to do.
        $this->modul = CM_getParameter(MODUL);
        if ($action==""){
            // Get back the action: as: Add, Delete, Edit or List.
             $action = CM_getParameter(ACTION);
        }
               
		//include_once(DIR_MODEL."md_cat_san_pham.class.php");
        //$objCatSanpham = new MD_CatSanpham($this->db);
		include_once(DIR_MODEL."md_san_pham.class.php");
	    $objSanpham = new MD_Sanpham($this->db);
        switch($action){  
			case "List":
			default :{
				//unset($_SESSION['ten_sp'],$_SESSION['loai_sp_search']);
				include_once("../includes/i_timkiem.php");				
				//include(DIR_VIEW."v_home_slideshow.php");
				//$arrayData_KM = $objSanpham->getByWhere("*","view_o_trang_chu=1 and hien_thi=1 and gia_sp_km>0","thu_tu asc"); // san pham khuyen mai
				//$arrayData_New = $objSanpham->getByWhere("*","view_o_trang_chu=1 and hien_thi=1 and gia_sp_km=0","id desc"); // san pham moi
				//$arrayData_BC = $objSanpham->getByWhere("*","view_o_trang_chu=1 and hien_thi=1 and solanban>0","solanban desc"); // san pham ban chay
				include_once(DIR_VIEW."v_home_list.php");
				//V_HomeList($arrayData_KM,$arrayData_New,$arrayData_BC,"List");
            break; 
			}            
        }
        unset($arrayData_KM,$arrayData_New,$arrayData_BC);
    }      
} 
?>